<?php
$tbGallery = new M_DbTable_Gallery();
$listGallery = $tbGallery->getListActive()->query()->fetchAll();
?>
<div id="slide" class="nivoSlider" style="width: 958px;">
    <?php if($listGallery): ?>
        <?php foreach($listGallery as $v): ?>
        	<?php if($v['link_to']): ?>
        		<a href="<?php echo $v['link_to']; ?>">
        			<img class="images-slide-show" src="<?php echo $v['path']; ?>" title="<?php echo $v['caption']; ?>" alt="<?php echo $v['caption']; ?>" />
        		</a>
        	<?php else: ?>
        		<img class="images-slide-show" src="<?php echo $v['path']; ?>" title="<?php echo $v['caption']; ?>" alt="<?php echo $v['caption']; ?>"/>
        	<?php endif; ?>	
        <?php endforeach; ?>
    <?php else: ?>
    	<img class="images-slide-show" src="/var/upload/slide-show/1.jpg" />
    	<img class="images-slide-show" src="/var/upload/slide-show/2.jpg" />
    	<img class="images-slide-show" src="/var/upload/slide-show/3.jpg" />
    	<img class="images-slide-show" src="/var/upload/slide-show/4.jpg" />
    	<img class="images-slide-show" src="/var/upload/slide-show/5.jpg" />
    	<img class="images-slide-show" src="/var/upload/slide-show/6.jpg" />
    <?php endif; ?>
</div>
<div class="clear"></div>
<script type="text/javascript">
	$(window).load(function() {
		$('#slide').nivoSlider();
	});
</script>